<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>string的学习</title>
</head>
<body>
	<script type="text/javascript">
	//找到一个字符串中指定字符出现的位置
	function location (string,char) {
		var position = new Array();
		var pos = string.indexOf(char);
		while(pos > -1){
			position.push(pos);
			pos = string.indexOf(char,pos + 1);
		}
		return position.toString();
	}

	var str = "hello everybody";
	var po = location(str,"e");
	console.log(po);
	</script>
</body>
</html>